<div class="row">
	<div class="span5">
		<h2>Your Universities</h2>
		<table class="table table-bordered table-striped">
			<tbody>
				<?php foreach ($userUnniversities as $userUniversity) : ?>
				<tr>
					<td class="span4"><?php if ($userUniversity->is_primary) echo '<b>'; ?><?php echo CHtml::encode($userUniversity->university->name); ?><?php if ($userUniversity->is_primary) echo '</b>'; ?></td>
					<td><?php echo $userUniversity->is_primary ? '<b>Is primary</b>' : CHtml::link('Set primary', array('/textbooks/profile/universities', 'university_id'=>$userUniversity->university_id)) ; ?></td>
					<td><?php echo CHtml::link('Remove', array('/textbooks/profile/removeUniversity', 'id'=>$userUniversity->id)); ?></td>
				</tr>
				<?php endforeach; ?>
				<tr>
					<td class="span4" colspan="3">					
					<?php /** @var BootActiveForm $form */
					$form = $this->beginWidget('bootstrap.widgets.BootActiveForm', array(
						'id' => 'textbook-user-university-form',
						'type' => 'inline',
						'enableAjaxValidation' => true,
						'enableClientValidation' => true,
						'htmlOptions' => array('class'=>'modal-form'),
					)); ?>
						<?php echo $form->errorSummary($model); ?>
						<?php echo $form->dropDownList($model, 'university_id', CMap::mergeArray(array('0'=>'[Select one]'), CHtml::listData($universities, 'id', 'name')),  array('class'=>'span4')); ?>
						<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'plus', 'label'=>'Add university')); ?>
					<?php $this->endWidget(); ?>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
